package com.woniuxy.book87.mapper;

import com.woniuxy.book87.entity.Permission;
import com.woniuxy.book87.vo.PermissionMenuVo;
import com.woniuxy.book87.vo.PermissionVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

public interface PermissionMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Permission record);

    Permission selectByPrimaryKey(Long id);

    List<Permission> selectAll();

    int updateByPrimaryKey(Permission record);

    List<PermissionMenuVo> selectAllPermisionMenuVo();

    List<PermissionVo> selectPermissionByName(String name);

    @Select("select p.id,p.name from t_url_permission p where p.parent_id=-1")
    List<PermissionMenuVo> selectAllparentMenu();

    @Delete("delete from t_url_permission where parent_id = #{id}")
    void deletePermissionByParentId(Long id);
}